//
//  TextAndImageTableViewCell.m
//  Comma
//
//  Created by liuyunqing on 15/1/17.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "TextAndImageTableViewCell.h"
#import "GlobalMacro.h"
@implementation TextAndImageTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 头像
        self.headerImage = [[UIImageView alloc] initWithFrame:CGRectMake(8, 8, 32, 32)];
        [_headerImage.layer setCornerRadius:16.0f];
        _headerImage.clipsToBounds = YES;
        [self.contentView addSubview:_headerImage];
        // 类别
        self.styleLabel = [[UILabel alloc] initWithFrame:CGRectMake(48, 17, 40, 14)];
        [_styleLabel setFont:[UIFont fontWithName:@"Helvetica" size:14.0f]];
        [_styleLabel setTextColor:REDCOLOR];
        [self.contentView addSubview:_styleLabel];
        // 标题
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(92, 17, SCREEN_WIDTH - 100, 14)];
        [_titleLabel setFont:[UIFont fontWithName:@"Helvetica" size:14.0]];
        [_titleLabel setTextColor:GREENCOLOR];
        [self.contentView addSubview:_titleLabel];
        // 姓名
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(48, 45, 48, 11)];
        [_nameLabel setFont:[UIFont boldSystemFontOfSize:11.0f]];
        [self.contentView addSubview:_nameLabel];
        // 信息
        self.infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(96, 50, 243, 10)];
        [_infoLabel setFont:[UIFont fontWithName:@"Helvetica" size:11.0f]];
        [self.contentView addSubview:_infoLabel];
        // 学校
        self.puberSchool = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
        [_puberSchool setFont:[UIFont fontWithName:@"Helvetica" size:11.0f]];
        [self.contentView addSubview:_puberSchool];
        // 时间
        self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 33, 50, 25, 10)];
        [self.contentView addSubview:_timeLabel];
        // 发布信息
        self.infoTextLabel = [[UILabel alloc] initWithFrame:CGRectMake(96, 73, SCREEN_WIDTH - 100, 10)];
        [_infoTextLabel setFont:[UIFont fontWithName:@"Helvetica" size:11.0f]];
        [self.contentView addSubview:_infoTextLabel];
        // 发布图片
        self.infoImage = [[UIImageView alloc] initWithFrame:CGRectMake(92, 97, 80, 80)];
        [self.contentView addSubview:_infoImage];
        // 点赞
        self.praiseButton = [[UIButton alloc] initWithFrame:CGRectMake(262, 116, 12, 19)];
        [self.contentView addSubview:_praiseButton];
        // 点赞数
        self.priseLabel = [[UILabel alloc] initWithFrame:CGRectMake(269, 116, 32, 19)];
        [self.contentView addSubview:_priseLabel];
        // 点踩
        self.trampleButton = [[UIButton alloc] initWithFrame:CGRectMake(310, 116, 12, 19)];
        [self.contentView addSubview:_trampleButton];
        // 点踩数
        self.trampleLabel = [[UILabel alloc] initWithFrame:CGRectMake(317, 116, 32, 19)];
        [self.contentView addSubview:_trampleLabel];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.nameLabel sizeToFit];
    [self.infoLabel setFrame:CGRectMake(self.nameLabel.frame.origin.x + self.nameLabel.frame.size.width, 45, 0, 0)];
    [self.infoLabel sizeToFit];
    [self.puberSchool setFrame:CGRectMake(self.infoLabel.frame.origin.x + self.infoLabel.frame.size.width, 45, 0, 0)];
    [self.puberSchool sizeToFit];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
